package com.sciencep.pro.common.utils;


import java.math.BigDecimal;
import java.math.RoundingMode;

public class MathUtil {

    private MathUtil() {

    }

    public static double divide(double a, double b, int scale) {
        BigDecimal bd1 = BigDecimal.valueOf(a);
        BigDecimal bd2 = BigDecimal.valueOf(b);

        return bd1.divide(bd2, scale, RoundingMode.HALF_UP).doubleValue();
    }

}
